package prj.carmap.mobile.process;

import android.app.Application;
import android.util.Log;
import android.widget.Toast;

import com.baidu.mapapi.MKGeneralListener;
import com.baidu.mapapi.map.MKEvent;

/**
 * 百度地图通用侦听器
 *
 */
public class BMapGeneralListener implements MKGeneralListener {
	/** Application引用 */
	Application application;

	public BMapGeneralListener(Application application) {
		this.application = application;
	}

	@Override
	public void onGetNetworkState(int iError) {
		if (iError == MKEvent.ERROR_NETWORK_CONNECT)
		{
			Toast.makeText(application.getApplicationContext(), "您的网络出错啦！", Toast.LENGTH_LONG).show();
		}
		else if (iError == MKEvent.ERROR_NETWORK_DATA)
		{
			Toast.makeText(application.getApplicationContext(), "输入正确的检索条件！", Toast.LENGTH_LONG).show();
		}
		// ...
	}

	@Override
	public void onGetPermissionState(int iError) {
		//非零值表示key验证未通过
		if (iError != 0)
		{
			Toast.makeText(application.getApplicationContext(), "您的key验证未通过！", Toast.LENGTH_LONG).show();
			Log.e("" + iError, "请检查文件输入正确的授权Key，并检查您的网络连接是否正常");
		}

	}
}
